# -- coding: utf-8 --
import requests,json

def post_demo():
    post_header = {"content-type": "application/json"}
    url = "http://coolaf.com/tool/params?r=rtest&t2=rtest2"
    body = {
        "s": "stest",
        "i": "itest2",
        "user": "zhoukangkang"
    }
    re = requests.post(url, headers=post_header, data=json.dumps(body))
    print("code::::\n", re.status_code)
    # print("connection::::\n", re.connection)
    # print("content::::\n", re.content)
    # print("cookies::::\n", re.cookies)
    # print("json::::\n", re.json)
    # print("text::::\n", re.text)
    assert re.status_code == 200



def get_demo():
    get_header = {"content-type": "application/json"}
    url = "http://www.metools.info"
    parm = {
        "orgID": "992",
        "user" : "zkk"
    }
    re2 = requests.get(url, headers=get_header, params=parm)
    print(re2.status_code)
    print(re2.json)
    assert re2.status_code == 200



if __name__ == '__main__':
    post_demo()
    get_demo()